package com.qf.demo.controller;

import com.baomidou.kaptcha.Kaptcha;
import com.qf.demo.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/user")
public class ImgController {
    @Autowired
    Kaptcha kaptcha;
    @RequestMapping("/login")
    public ResultVo regist(HttpSession session,String captchar){

        boolean validate = kaptcha.validate(captchar);
        if(validate){
            return ResultVo.ok();
        }
       return ResultVo.error("验证码错误");

    }
}
